package cn.hls.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import cn.hls.dao.ShipperDao;
import cn.hls.entity.Shipper;
import cn.hls.entity.vo.PageInfo;
import cn.hls.service.ShipperService;
/**
  *@fileName: ShipperServiceBean.java
  *@package: cn.hls.service.impl
　*@Description:托运方基本信息业务逻辑接口实现类
　*@author: yinghui.zhang
　*@email: uuhui@163.com
  *@date: 2016年6月10日
 *
 */
@Component("shipperService")
public class ShipperServiceBean extends BaseServiceBean<Shipper> implements
		ShipperService {
	@Resource(name = "shipperDao")
	private ShipperDao dao;

	@Override
	public PageInfo<Shipper> loadShipperInfo(Shipper entity,
			PageInfo<Shipper> page) throws Exception {
		return dao.loadShipperInfo(entity, page);
	}
	
	@Override
	public List<Shipper> loadShipperList(Shipper entity)throws Exception{
		return dao.loadShipperList(entity);
	}

	@Override
	public boolean exists(Shipper entity) throws Exception {
		return dao.exists(entity);
	}
	
	@Override
	public void delete(Object entityId) throws Exception {
		dao.delete(entityId);
	}
	
	@Override
	public boolean update(Shipper entity) throws Exception {
		Shipper tempShipper=dao.find(entity.getId());
		Date createTime=tempShipper.getCreateTime();
		BeanUtils.copyProperties(entity, tempShipper);
		tempShipper.setCreateTime(createTime);
		tempShipper.setUpdateTime(new Date());
		return super.update(tempShipper);
	}

}
